import type { LoginParams, LoginResult, UserInfo } from '@/interfaces/user';
import { request } from '@umijs/max';


export async function login(data: LoginParams): Promise<LoginResult> {
  return await request('/api/v1/auth/login', { method: 'POST', data})
}

export async function logout() {
  await request('/api/v1/auth/logout', { method: 'POST'})
}

export async function fetchUserInfo():Promise<UserInfo> {
  const resp = await request('/api/v1/users/currentUser')
  return resp.data
}

